package lion.dev.web.useragent.parser;

import java.util.ArrayList;
import java.util.List;

import lion.dev.lang.KV;
import lion.dev.web.useragent.IUAParser;
import lion.dev.web.useragent.UserAgent;

/**
 * @author lion
 * @email hl_0074@sina.com
 * @date 2014年6月6日
 */
public class DeviceParser implements IUAParser {

	private String name;

	public DeviceParser(String name) {

		this.name = name;
	}

	@Override
	public boolean visit(String token, UserAgent agent) {

		agent.setDevice(this.name);

		return true;
	}

	@Override
	public List<KV<String, String>> explain(String token) {

		List<KV<String, String>> result = new ArrayList<>();

		result.add(new KV<>(token, this.name));

		return result;
	}
}
